﻿<UserControl x:Class="Songhay.BiggestBox.Desktop.Modules.RestWeather.Views.NoaaWeatherView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
    xmlns:rxSharedModels="clr-namespace:Songhay.BiggestBox.Portable.Shared.Models;assembly=Songhay.BiggestBox.Portable.Shared"
    xmlns:vc="clr-namespace:Songhay.ValueConverters;assembly=Songhay.Mvvm"
    d:DesignWidth="{x:Static rxSharedModels:AppScalars.ModuleWidth}" d:DesignHeight="{x:Static rxSharedModels:AppScalars.ModuleHeight}">
    <UserControl.Resources>
        <vc:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="10*" />
            <RowDefinition Height="90*" />
        </Grid.RowDefinitions>
        <TextBlock Style="{StaticResource H1Style}" Text="REST Weather (NOAA)" />
        <mah:ProgressRing Grid.Row="1" IsActive="{Binding IsDoingServiceOperation}" />
        <Grid Grid.Row="1"
            Visibility="{Binding IsDoingServiceOperation, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter='true'}" Margin="0,1,0,-1">
            <FlowDocumentScrollViewer VerticalScrollBarVisibility="Auto">
                <FlowDocument>
                    <Paragraph>
                        <Bold>Location:</Bold>
                        <TextBlock Text="{Binding WeatherModel.Location, FallbackValue='Los Angeles'}" />
                        <Run>observed at</Run>
                        <TextBlock Text="{Binding WeatherModel.ObservationTime, FallbackValue='10/25/2014 9:35PM'}" />
                    </Paragraph>
                    <Paragraph>
                        <Bold>Condition:</Bold>
                        <TextBlock Text="{Binding WeatherModel.Weather, FallbackValue='Fair'}" />
                    </Paragraph>
                    <Paragraph>
                        <Bold>Sunrise:</Bold>
                        <TextBlock Text="{Binding SunriseSunsetModel.MorningSunrise, FallbackValue='06:50:16', StringFormat='HH:mm'}" />
                        <Bold>Sunset:</Bold>
                        <TextBlock Text="{Binding SunriseSunsetModel.EveningSunset, FallbackValue='19:10:19', StringFormat='HH:mm'}" />
                    </Paragraph>
                    <Paragraph>
                        <Run>The temperature at observation time was</Run>
                        <TextBlock Text="{Binding WeatherModel.TemperatureFahrenheit, FallbackValue='77', StringFormat='{}{0}°F'}" />
                        <TextBlock Text="{Binding WeatherModel.TemperatureCelsius, FallbackValue='25', StringFormat='({0}°C)'}" />
                        <Run>with relative humidity</Run>
                        <TextBlock Text="{Binding WeatherModel.RelativeHumidity, FallbackValue='80', StringFormat='{}{0}%'}" />
                        <Run>.</Run>
                    </Paragraph>
                </FlowDocument>
            </FlowDocumentScrollViewer>
        </Grid>
    </Grid>
</UserControl>
